package com.sk.sourcecircle.dialog;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.View;
import android.widget.TextView;

import com.sk.sourcecircle.R;
import com.sk.sourcecircle.base.BaseDialogFragment;
import com.sk.sourcecircle.callback.MyCallBack;

import butterknife.BindView;
import butterknife.OnClick;
import butterknife.Unbinder;

/**
 * Created by sk on 2017/12/13.
 */

public class TipDialogFragment extends BaseDialogFragment {
    @BindView(R.id.tv_tip)
    TextView tvTip;
    @BindView(R.id.cancel)
    TextView cancel;
    @BindView(R.id.sure)
    TextView sure;
    Unbinder unbinder;

    private String content;
    private MyCallBack myCallBack;

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public MyCallBack getMyCallBack() {
        return myCallBack;
    }

    public void setMyCallBack(MyCallBack myCallBack) {
        this.myCallBack = myCallBack;
    }

    @Override
    protected int getContentView() {
        return R.layout.dialog_tip;
    }

    @Override
    public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);
        if(content!=null){
            tvTip.setText(content);
        }
    }

    @OnClick({R.id.cancel, R.id.sure})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.cancel:
                dismiss();
                break;
            case R.id.sure:
                myCallBack.sure();
                dismiss();
                break;
        }
    }
}
